package com.czk.ssaa2aagentcall.config;

import com.alibaba.cloud.ai.graph.agent.BaseAgent;
import com.alibaba.cloud.ai.graph.agent.a2a.A2aRemoteAgent;
import com.alibaba.cloud.ai.graph.agent.a2a.AgentCardProvider;
import com.alibaba.cloud.ai.graph.exception.GraphStateException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author chenzhangkun
 * @ClassName RootAgentConfiguration
 * @description: TODO
 * @date 2025年11月21日
 */
@Configuration
public class RootAgentConfiguration {
    @Bean
    public BaseAgent rootAgent(AgentCardProvider agentCardProvider) throws GraphStateException {
        return A2aRemoteAgent.builder()
                // 传入自动构建的Nacos AgentCard Provider
                .agentCardProvider(agentCardProvider)
                // 设置需要的Agent的名称，Nacos AgentCard Provider会根据此名称自动订阅AgentCard和Agent的可访问端点
                .name("emotionAgent")
                .description("Answer Nacos questions or query and operate datum in Nacos.")
                .inputKey("messages")
                .outputKey("messages")
                .build();
    }

}
